#pragma once
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>

typedef int HPdata;

typedef struct Heap
{
	HPdata* a;
	int size;
	int capacity;
}HP;

void HeapInit(HP* php);
void HeapPush(HP* php,HPdata x);
void HeapPop(HP* php);

void AdjustUp(HPdata* a, int child);
void Adjustdown(HPdata* a,int n,int parent);

void Heapsort(int* a, int n);